using System;
using System.Data;
using Utils;
using Utils.DatabaseUtils;


namespace QLCG.DAO
{
public class tblChuyenMonUI
{ 
	private int idChuyenMon;
	public int IdChuyenMon
	{
		get { return idChuyenMon;}
		set { idChuyenMon = value;}
	}

	private String tenChuyenMon;
	public String TenChuyenMon
	{
		get { return tenChuyenMon;}
		set { tenChuyenMon = value;}
	}

	private String moTa;
	public String MoTa
	{
		get { return moTa;}
		set { moTa = value;}
	}

	private DateTime ngayTao;
	public DateTime NgayTao
	{
		get { return ngayTao;}
		set { ngayTao = value;}
	}

	public tblChuyenMonUI() {}

	public tblChuyenMonUI(int idChuyenMon, String tenChuyenMon, String moTa, DateTime ngayTao)
	 {
		this.idChuyenMon = idChuyenMon;
 		this.tenChuyenMon = tenChuyenMon;
 		this.moTa = moTa;
 		this.ngayTao = ngayTao;
 	}

	public int Add(String tenChuyenMon, String moTa, DateTime ngayTao)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblChuyenMon_Add",tenChuyenMon,moTa,ngayTao);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int Update(int idChuyenMon, String tenChuyenMon, String moTa, DateTime ngayTao)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblChuyenMon_Update",idChuyenMon,tenChuyenMon,moTa,ngayTao);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int Delete(int idChuyenMon)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblChuyenMon_Delete",idChuyenMon);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int DeleteAll()
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblChuyenMon_DeleteAll");
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public DataSet Get(int idChuyenMon)
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"tblChuyenMon_Get",idChuyenMon);
			return result;
		}
		catch(Exception e) {return null; }
	}

	public DataSet GetAll()
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"tblChuyenMon_GetAll");
			return result;
		}
		catch(Exception e) {return null; }
	}

} 
}
